<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" href="../../js/plugins/layui-v2.4.5/layui/css/layui.css" />
		<link rel="stylesheet" href="../../css/reset.css" />
		<link rel="stylesheet" href="../../css/list.css" />
	</head>
	<body class="p10">
		<div class="container p15">
			<div class="btn-container"><a href="javascript:;" id="addBtn" class="layui-btn layui-btn-sm">添加</a></div>
			<table id="list" lay-filter="list"></table>
		</div>
		<script src="../../js/jquery-3.3.1.min.js"></script>
		<script src="../../js/plugins/layui-v2.4.5/layui/layui.js"></script>
		<script>
			var data = [{
					id: 1,
					name: '网络机房',
					address: '博大大厦5层',
					manager: '李主管'
				},
				{
					id: 2,
					name: '服务器机房',
					address: '博大大厦5层',
					manager: '李主管'
				}
			];
			layui.use(['table'],function(){
				var table = layui.table;
				//第一个实例
				  table.render({
					elem: '#list'
					,height: '300'
					,url: '' //数据接口
					,page: true //开启分页
					,cols: [[ //表头
					  	{
					  		field: 'xh',
					  		title: '序号',
					  		width: 80,
					  		align: 'center',
					  		templet: function(d) {
					  			return d.LAY_INDEX;
					  		}
					  	}, {
					  		field: 'name',
					  		title: '机房名称',
					  		align: 'center'
					  	}, {
					  		field: 'address',
					  		title: '所在位置',
					  		align: 'center'
					  	}, {
					  		field: 'manager',
					  		title: '机房负责人',
					  		align: 'center'
					  	}, {
					  		field: 'opt',
					  		title: '操作',
					  		width: 160,
					  		align: 'center',
					  		templet: function(d) {
					  			return `<a href="javascript:;" class="layui-btn layui-btn-normal layui-btn-xs"><i class="layui-icon layui-icon-edit"></i>编辑</a>
					  					  &nbsp;<a href="javascript:;" class="layui-btn layui-btn-danger layui-btn-xs"><i class="layui-icon layui-icon-delete"></i>删除</a>`
					  		}
					  	}
					]]
					,data:data
				  });
			})
			$(function(){
				$("#addBtn").click(function(){
					top.tabAdd('机房新增','jifang_add','pages/jifang/jifang_add.html',true,true);
					
				})
			})
		</script>
	</body>
</html>
